﻿@model CDV.MC.MatrixDriver.WebApp.Data.ClientInfo
<div id=@( string.Concat("client_" , Model.ToString())) class="row clientListItem">
    <div class="col-md-3">
        <a href=@("/Client/ClientDetail?address=" + Model.ToString())>
            <img id="iconStatus" src=@(Model.IsWebClient ? "/images/webclient.png": "/images/client.png")
                 class=@(Model.IsOnline ? "matrixIcon-online" : "matrixIcon-offline") />
        </a>
    </div>
    <div class="col-md-9">
        <dl class="dl-horizontal matrixListItem-title">
            <dt>
                @Html.DisplayNameFor(model => model.HostName)
            </dt>
            <dd>
                @Html.ActionLink(Model.HostName, "ClientDetail", new { address = Model.ToString() })
            </dd>
            <dt>
                @Html.DisplayNameFor(model => model.IP)
            </dt>
            <dd>
                @Html.DisplayFor(modelItem => Model.IP)
            </dd>
            <dt>
                @Html.DisplayNameFor(model => model.Port)
            </dt>
            <dd>
                @Html.DisplayFor(modelItem => Model.Port)
            </dd>
            <dt>
                @Html.DisplayNameFor(model => model.UserID)
            </dt>
            <dd>
                @Html.DisplayFor(modelItem => Model.UserID)
            </dd>
            <dt>
                @Html.DisplayNameFor(model => model.FirstConnectTime)
            </dt>
            <dd>
                @Html.DisplayFor(modelItem => Model.FirstConnectTimeDisplay)
            </dd>
            <dt>
                @Html.DisplayNameFor(model => model.LastConnectTime)
            </dt>
            <dd id="lastConnectTime">
                @Html.DisplayFor(modelItem => Model.LastConnectTimeDisplay)
            </dd>
            <dt>
                @Html.DisplayNameFor(model => model.Duration)
            </dt>
            <dd id="duration">
                @Html.DisplayFor(modelItem => Model.Duration)
            </dd>
            <dt>
                @Html.DisplayNameFor(model => model.ConnectedToMatrices)
            </dt>
            <dd id="linkMatrices">
                @{
                    var lastMatrixId = Model.ConnectedToMatrices.LastOrDefault().Key;
                    foreach (var matrix in Model.ConnectedToMatrices)
                    {
                        @Html.ActionLink($"{matrix.Key}:{matrix.Value}" + (matrix.Key == lastMatrixId ? string.Empty : ","), "MatrixDetail", "matrix", new { matrixId = matrix.Key })
                    }
                }
            </dd>
            <dt>
                @Html.DisplayNameFor(model => model.IsOnline)
            </dt>
            <dd>
                <div id="circleStatus" class=@(Model.IsOnline?"matrixCircle-online":"matrixCircle-offline")
                     title=@(Model.IsOnline ? "在线" : "离线") />
            </dd>
        </dl>
    </div>
</div>

